
#include <stdlib.h>
#include "dll.h"

void		dll_add(t_dll **node, t_dll *new)
{
  t_dll		*p_node;
  t_dll		*n_node;
  t_dll		*c_node;

  p_node = *node;
  n_node = NULL;
  c_node = NULL;
  if (new != NULL)
    {
      c_node = new;
      if (p_node != NULL)
	n_node = p_node->next;
      if (n_node != NULL)
	n_node->prev = c_node;
      c_node->prev = p_node;
      if (p_node != NULL)
	p_node->next = c_node;
      *node = c_node;
    }
}
